package router

import (
	"github.com/gin-gonic/gin"
	"takeout-ordering/api/handler"
	"takeout-ordering/pkg"
)

func LoadRouter(r *gin.Engine) {
	user := r.Group("/user")
	{
		user.POST("/register", handler.UserRegister) // todo 用户注册
		user.POST("/login", handler.UserLogin)       // todo 用户登录
	}
	meals := r.Group("/meals")
	{
		meals.POST("/order/pay/back", handler.Payback) // todo 支付回调
		meals.Use(pkg.JWTAuth("2209a"))
		meals.POST("/list", handler.MealsList)                // todo 餐品列表展示
		meals.POST("/upload", handler.Upload)                 // todo 图片上传
		meals.POST("/create/order", handler.CreateOrder)      // todo 创建订单
		meals.POST("/order/pay", handler.OrderPay)            // todo 订单支付
		meals.POST("/find/coupon", handler.FindCoupon)        // todo 拥有优惠卷列表
		meals.POST("/user/order/list", handler.UserOrderList) // todo 订单列表展示
		meals.POST("/coupon/receive", handler.CouPonReceive)  // todo 优惠卷领取
	}

}
